Phone notifications from the Pi coding agent
Updated December 2, 2026
Pi is intentionally minimal: it gives you a clean CLI and simple TypeScript extensions instead of bloated built-ins. Add a 20-line extension so long headless or SSH runs ping your phone when they finish — without waking you for 5-second turns.
1. Lightweight Pi extension (only long runs)
Create ~/.pi/agent/extensions/nextmsg.ts and export NEXTMSG_KEY in your shell (key from Settings → Send keys → Add send key → Copy a key). This only sends a push if a run took at least 60 seconds:
import path from "node:path";
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
const MIN_DURATION_MS = 60_000;
export default function (pi: ExtensionAPI) {
let startedAt = 0;
pi.on("agent_start", () => {
startedAt = Date.now();
});
pi.on("agent_end", async () => {
const key = process.env.NEXTMSG_KEY;
const elapsed = Date.now() - startedAt;
if (!key || !startedAt || elapsed < MIN_DURATION_MS) return;
const repo = path.basename(process.cwd());
const mins = Math.round(elapsed / 1000);
await fetch("https://api.nextmsg.app/v1/send", {
method: "POST",
headers: {
Authorization: `Bearer ${key}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
channel: "pi",
message: `Pi finished in \`${repo}\` (${mins}s)`
})
}).catch(() => {});
});
}2. Via MCP extension or AGENTS.md
If you use a Pi MCP extension (such as pi-mcp-extension), connect either to the remote endpoint https://api.nextmsg.app/mcp (with Authorization: Bearer $NEXTMSG_KEY) or locally to npx -y @nextmsg/mcp.
Or skip MCP altogether — pair once with npx -y @nextmsg/mcp --pair K73M-QX9P and add two lines to your AGENTS.md so Pi uses its existing bash tool when you ask to be notified:
When I ask to be notified on my phone after a long run, execute:
npx -y @nextmsg/mcp "short summary (no secrets)" --channel piMore guides
- Phone notifications from OpenCode
- OpenClaw one-way phone alerts for 24/7 scheduled briefings
- Hermes Agent 24/7 gateway notifications to your phone
- Daily website and database reports on your phone
- Make Claude Code, Cursor or any AI agent ping your phone
- Get notified when a cron job or backup finishes or fails