← Back to integrations
Pi

Integration guide

Active

Pi + OpenPets

Connect Pi to OpenPets with the @open-pets/pi extension package, automatic safe reactions, manual slash commands, and no prompt or tool-output forwarding.

What this integration does

The Pi integration is an extension package, not an MCP setup. It loads inside Pi, listens to Pi session and tool events directly, and forwards a small set of safe reactions to your running OpenPets desktop app through @open-pets/client.

PartWhat it doesWhy it matters
Pi extension Subscribes to Pi session, agent, and tool events. The pet can react automatically while Pi thinks, edits, runs commands, succeeds, or errors.
OpenPets IPC client Sends reactions and short status messages over local IPC. Runtime is local. Pi never depends on a remote service to control the pet.
/openpets commands Adds status, test, react, and say subcommands. Users can verify the connection and trigger manual reactions from inside Pi.

Runtime control is best-effort. Pi keeps working if the OpenPets desktop app is closed; the extension quietly skips pet updates until the desktop app is reachable again.

Install

Keep the OpenPets desktop app running, then install the Pi extension package with Pi. Use global setup for your machine, or project-local setup for a single repository.

Global setupbash
pi install npm:@open-pets/pi
Project-local setupbash
pi install -l npm:@open-pets/pi

Global setup writes to Pi's global package settings. Project-local setup writes to .pi/settings.json, which is better when a repository should explicitly carry its OpenPets behavior. Reload or restart Pi after changing package settings so the new extension is loaded.

Slash commands

The extension registers one user-facing command namespace so you can test and steer the integration without adding extra Pi tools. None of these commands forward prompts or tool output.

CommandPurpose
/openpets statusCheck whether the OpenPets desktop app is reachable and which pet is targeted.
/openpets testSend a short test reaction and waving message.
/openpets react <reaction>Manually set a safe reaction such as thinking, testing, success, or error.
/openpets say <message>Show one short validated speech bubble.
/openpets helpPrint the available subcommands inside Pi.

Manual say input goes through the same OpenPets validator the desktop app uses: brief, single-line, user-facing, and never code, logs, paths, URLs, prompts, or secrets.

Automatic event reactions

The extension maps Pi lifecycle events to pet reactions without asking the model to call a tool. Most events are silent reaction-only updates; only errors may speak, and only with a fixed safe message.

Pi eventConditionReactionSpeech
session_startPi starts, resumes, or reloads.wavingNone by default.
agent_startAgent loop begins.thinkingNone.
turn_startNew turn begins.workingNone.
tool_execution_startTool looks like edit/write/patch/apply.editingNone.
tool_execution_startTool or shell command looks test-like.testingNone.
tool_execution_startShell/bash command, non-test.runningNone.
tool_execution_startOther tool.workingNone.
tool_execution_endisError is true.errorShort fixed error-pool message, throttled.
agent_endAgent loop finishes without a recent tool error.successNone.
session_shutdownPi quits, reloads, switches, or forks.idleNone.

The extension may inspect bounded tool-name and command slices only to classify reactions. It does not speak raw commands, output, prompts, or file paths. OpenPets-related commands are filtered out so the pet cannot self-trigger.

Safety and behavior

The Pi extension follows the same safety model as Claude Code, OpenCode, and the MCP server. It is designed for ambient visible status only.

ProtectionBehavior
No transcript forwardingAutomatic events never send prompts, assistant text, tool input, tool output, file contents, URLs, paths, or secrets.
Validated manual speech/openpets say rejects multi-line, long, code-like, URL/path-like, or secret-looking text.
Best-effort runtimeOpenPets failures never block Pi model calls or tool execution.
No Pi tools in MVPThe extension registers a user slash command only. It does not expose model-callable Pi tools.
Trusted package boundaryPi extensions run with local system permissions, so install only packages you trust.
Self-trigger guardTool calls related to OpenPets are ignored by the event mapper.

Pet routing

By default, automatic reactions and manual commands target the desktop default pet. Explicit per-extension pet routing is deferred until a later Pi subphase so the runtime contract stays simple.

Runtime pathtext
Pi
  -> @open-pets/pi extension
  -> @open-pets/client
  -> OpenPets desktop local IPC
  -> default pet

Troubleshooting

The pet does not react

  • Confirm the OpenPets desktop app is running.
  • Run /openpets status inside Pi.
  • Reload or restart Pi after installing or removing the package.
  • Remember that most automatic events are reaction-only and intentionally silent.

Remove the package

Remove global installbash
pi remove npm:@open-pets/pi

For project-local installs, run the remove command from the project where you installed the package and follow Pi's project settings behavior.

Status

The @open-pets/pi package is published on npm and follows the same safety model as the other OpenPets integrations. The Pi package API surface this version is built against is @earendil-works/pi-coding-agent; pin or upgrade Pi as part of your normal Pi update flow.

by Alvin