Pi Talk Mode extension A developer has built a "Talk Mode" extension for the Pi coding agent that prevents the AI from editing, creating, or modifying files. The extension, toggled with Shift+Tab, injects a system prompt that restricts the agent to read-only operations, analysis, and discussion while blocking any implementation actions. When active, the extension displays a "💬 talk" status indicator and prevents the AI from applying changes even if explicitly requested. | import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent"; | | | const STATUS KEY = "talk-mode"; | | | const SHORTCUT = "shift+tab"; | | | const TALK MODE PROMPT = | | | TALK MODE ACTIVE | | | You are in Talk mode. | | | Purpose of Talk mode: | | | - Help the user think, discuss, and reason before acting. | | | - Answer questions directly. | | | - Evaluate tradeoffs and technical decisions. | | | - Research and inspect the codebase when useful. | | | - Help design an approach or make a plan. | | | - Review possible changes without applying them. | | | - Slow down implementation pressure and avoid jumping straight to code. | | | Hard restriction: | | | - Talk mode is not implementation mode. | | | - Do not edit, create, delete, move, or write files. | | | - Do not use edit or write tools. | | | - Do not run commands that modify files, git state, dependencies, services, or system state. | | | - Do not create temporary scripts, scratch files, or research files. | | | - Do not apply changes even if the user explicitly asks for a small tweak or direct implementation. | | | - If the user asks you to implement, modify, fix, apply, update, create, delete, or write something, tell them Talk mode is active and they need to disable Talk mode first. | | | Allowed: | | | - Read files. | | | - Search the codebase. | | | - Run read-only inspection commands. | | | - Analyze behavior. | | | - Explain options. | | | - Propose exact changes in prose. | | | - Provide patch snippets or code snippets for discussion only, without applying them. | | | - Make plans when requested. | | | Do not force a formal plan unless the user asks for one. ; | | | export default function talkModeExtension pi: ExtensionAPI : void { | | | let enabled = false; | | | function updateStatus ctx: ExtensionContext : void { | | | if enabled { | | | ctx.ui.setStatus STATUS KEY, ctx.ui.theme.fg "accent", "💬 talk" ; | | | } else { | | | ctx.ui.setStatus STATUS KEY, undefined ; | | | } | | | pi.events.emit "talk-mode:changed", enabled ; | | | } | | | pi.registerShortcut SHORTCUT, { | | | description: "Toggle Talk mode", | | | handler: async ctx = { | | | enabled = enabled; | | | updateStatus ctx ; | | | ctx.ui.notify enabled ? "Talk mode enabled" : "Talk mode disabled", "info" ; | | | }, | | | } ; | | | pi.on "session start", async event, ctx = { | | | updateStatus ctx ; | | | } ; | | | pi.on "before agent start", async event = { | | | if enabled return; | | | return { | | | systemPrompt: event.systemPrompt + TALK MODE PROMPT, | | | }; | | | } ; | | | } |