Last active
April 8, 2026 21:23
-
-
Save mj-meyer/0b20e3276fd9516bcf366c37e5bdec0a to your computer and use it in GitHub Desktop.
PI extension: capitalizes 'pi' → 'PI' in system prompts (Anthropic)
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
| 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; | |
| return { systemPrompt: replaced }; | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment