pi-events

Intercept and modify Pi agent events to block or transform tool calls.

Updated Mar 31, 2026
One-click install
npx skills add https://github.com/dotBeeps/hoard --skill pi-events
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: pi-events
Source: https://github.com/dotBeeps/hoard/tree/main/morsels/skills/pi-events
Command: npx skills add https://github.com/dotBeeps/hoard --skill pi-events

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Pi agents need reliable hooks to observe, modify, and control their runtime behavior; pi-events provides a unified way to intercept tool calls, user input, system prompt composition, and session lifecycle events so extensions can enforce safety, mutate arguments, and inject context without modifying core agent code.

Core Features & Use Cases

  • Tool Call Interception & Blocking: Pre-empt tool execution, mutate arguments in-place, or return a block reason to prevent dangerous operations.
  • Result & Input Transformation: Modify tool results before finalization and transform or handle raw user input before it reaches the LLM.
  • System Prompt & Context Injection: Inject persistent or transient messages and append system prompt text per turn for steering behavior.
  • Session & Model Event Handling: React to session start/switch/fork, compaction events, model selection, and message streaming for state restoration and telemetry.
  • Provider & Execution Inspection: Inspect or patch provider payloads and track tool execution lifecycle for logging or proxying.
  • Safety Patterns: Examples and anti-patterns showing confirmations for destructive actions, lightweight streaming handlers, and proper use of command-only context methods.

Quick Start

Intercept tool calls to block destructive shell commands and inject a transient system prompt reminding the assistant to be concise.

Frequently Asked Questions about pi-events

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I intercept and block tool calls in a Pi coding agent?

You can intercept Pi agent tool calls by registering an event handler that pre-empts execution, mutates arguments in-place, or returns a block reason to prevent the operation entirely.

Can I inject context or modify system prompts before an agent turn?

Yes, context injection allows you to inject persistent or transient messages and append system prompt text per turn to steer the assistant's behavior without modifying core agent code.

How do I transform user input before it reaches the LLM?

Input transformation is handled by intercepting raw user input through an event handler, allowing you to modify or handle the text before it is passed to the language model.

Does pi-events support session lifecycle and model switching events?

Session lifecycle events are fully supported, enabling you to react to session start, switch, fork, compaction events, model selection, and message streaming for state restoration.

What is the best way to enforce safety rules against destructive shell commands?

The recommended safety pattern uses tool call interception to block destructive shell commands, combined with transient system prompt injection to enforce specific behavioral constraints.

Can I inspect and patch provider payloads during tool execution?

Provider payload inspection and patching is supported, allowing you to track the tool execution lifecycle for logging, proxying, or modifying requests before they are finalized.