Skip to content

Instantly share code, notes, and snippets.

View mj-meyer's full-sized avatar
🏠
Working from home

MJ Meyer mj-meyer

🏠
Working from home
  • Auckland, New Zealand
  • 00:20 (UTC +12:00)
View GitHub Profile
@mj-meyer
mj-meyer / pi-to-PI-fix.ts
Last active April 8, 2026 21:23
PI extension: capitalizes 'pi' → 'PI' in system prompts (Anthropic)
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
// Replaces standalone lowercase "pi" with "PI" in the system prompt.
// Uses lookbehind/lookahead so paths like ~/.pi/ and pi-coding-agent are untouched.
export default function (pi: ExtensionAPI) {
pi.on("before_agent_start", (event, ctx) => {
if (ctx.model?.provider !== "anthropic") return;
const replaced = event.systemPrompt.replace(/(?<=^|\s)pi(?=\s|[,.]|$)/gm, "PI");
if (replaced === event.systemPrompt) return;