/abort or clicking buttons takes too long. Sometimes the model is deleting files or running commands you didn't want - every second counts.x and hit enter. The session stops immediately. The message isn't sent to the model, so you don't waste tokens or pollute your conversation history.chat.message, which fires when you send a message. If the message is exactly "x" (case-insensitive), it:session.abort() to stop the current generation~/.config/opencode/plugins/abort-on-x.ts:123456789101112131415import type { Plugin } from '@opencode-ai/plugin' export const AbortOnXPlugin: Plugin = async ({ client }) => ({ 'chat.message': async (input, output) => { const text = output.parts .filter((p) => p.type === 'text') .map((p) => (p as { text: string }).text.trim()) .join('') if (text.toLowerCase() === 'x') { output.parts.length = 0 await client.session.abort({ path: { id: input.sessionID } }) } }, })
~/.config/opencode/plugins/ load automatically on startup. No config changes needed..ts or .js files in ~/.config/opencode/plugins/ (global) or .opencode/plugins/ (per-project)opencode.json:123{ "plugin": ["opencode-wakatime", "opencode-helicone-session"] }