github earendil-works/pi v1.8.0

43 minutes ago

New Features

  • MCP 2026-07-28: Pi speaks the stateless MCP revision with servers that reject initialize, or with any server when "protocol": "2026-07-28" is set.
  • mcp.json schema: Add "$schema": "https://pi.dev/schemas/mcp.schema.json" to mcp.json for editor validation and completion.
  • Unloaded llama.cpp models in /model: When the router autoloads models, /model lists models from the Hugging Face cache and --models-dir, not only presets.
  • OpenRouter /images models: Codemode image generation supports OpenRouter image models that are served only on POST /images.
  • pi.appendUsage(): Extensions can record model usage that the session's messages do not carry, such as a subagent's; the footer's cost and session stats count it.

Breaking Changes

  • getShellConfig() returns commandTransport: "env" for Git Bash and other bash.exe on Windows, except WSL launchers: the command goes in the environment variable named by the new SHELL_COMMAND_ENV_VAR export, not after args. Extensions that spawn the shell from getShellConfig() must set that variable; appending the command to args fails with an error (#12340)
  • SessionManager.open(path) without sessionDir now creates new sessions (/new, /fork, /clone) in the default directory of the session's cwd instead of the opened file's folder. Pass the folder as sessionDir to keep the old behavior. usesDefaultSessionDir() now says whether a custom session directory was given, rather than comparing folders
  • Renamed OpenRouter's chat-completions image API from openrouter-images to openrouter-chat-images; openrouter-images now means OpenRouter's POST /images endpoint. Custom models.json entries with "api": "openrouter-images" for chat-completions image models must switch to openrouter-chat-images. Image models saved in the model store by pi 1.7.0 are migrated on load

Added

  • Added SessionManager.getCustomSessionDir(), the custom session directory (--session-dir, PI_CODING_AGENT_SESSION_DIR or the sessionDir setting), or undefined for default storage
  • Added MCP 2026-07-28, the stateless revision. Pi still starts every connection with initialize, so existing servers work as before. Servers that reject initialize are spoken to with 2026-07-28, and their tool list changes are followed with subscriptions/listen; a stdio server that exits or refuses server/discover after rejecting initialize is started once more. "protocol": "2026-07-28" in mcp.json uses it with servers that speak both revisions. See Protocol versions. Based on #12479 by @dmmulroy (#10416)
  • Added pi.appendUsage() so extensions can record model usage that the session's messages do not carry, such as a subagent's; the footer's cost and session stats count it (#12654, based on introspection-org/pi#2 by @brightsparc)
  • Published a JSON schema for mcp.json: add "$schema": "https://pi.dev/schemas/mcp.schema.json" for editor validation and completion (#12563)
  • Added OpenRouter image models that are served only on POST /images to codemode image generation, through the new openrouter-images API
  • Added the decision models jev-1.14, gemini-decision-1 and gpt-6-luna-decision from OpenCode Go (billed to the Go subscription) and OpenCode Zen for models.classify() in codemode and ctx.modelRegistry.classify() in extensions; Zen's jev-1.13 and jev-1.13-free now also take images (#12484)
  • Added Baseten's decision models (bison-1, groundhog-1, elephant-1, mammoth-1, joey-1) for models.classify() in codemode and ctx.modelRegistry.classify() in extensions (#12712)

Changed

  • /model now lists unloaded llama.cpp models from the Hugging Face cache and --models-dir, not only presets, when the router autoloads models; the router loads the selected model on the first request (#12730 by @julien-c)
  • Changed the opencode default model from the removed kimi-k2.7-code to kimi-k3.1-pro
  • Updated cross-spawn to 7.1.2 for GHSA-ghv9-86vm-4v8m (command injection when spawning batch files through cmd.exe on Windows). On Windows, an MCP command with embedded arguments (such as "npx -y foo") is now quoted as one command and fails, as it already did on Linux; put the arguments in args (#12729)
  • Updated minimatch to 11.0.9 for GHSA-cf2h-pxjq-68xw, GHSA-hqmv-qgp3-jx75 and GHSA-c859-jr93-m5j4 (slow compiling of long wildcard patterns, and memory growth from the pattern cache). Glob patterns in model selection, package filters and find on Windows that would expand to more than 100,000 patterns now fail with an error instead of hanging

Fixed

  • Fixed /login llama.cpp reporting that no models are loaded before its catalog refresh finished; the guidance now waits for the refresh and points to /model when models are available (#12730 by @julien-c)
  • Fixed a session resumed with another working directory, for example after choosing "continue in current cwd" at the missing-cwd prompt, being treated as stored in a custom --session-dir: /new, /fork and /clone saved into the old project's folder, /resume All listed only that folder, and the resume hint added --session-dir. /clone and /fork of such a session also went back to the missing cwd. Opening a session no longer creates its session directory; it is created when the first session file is written. The resume hint for a session opened from outside the session directory (pi --session <path>) gives that path. Based on #11562 by @juanibiapina
  • Fixed WSL detection in terminals that start the shell without the WSL environment variables (for example from a systemd user service): the Windows keybinding defaults (alt+v image paste, ctrl+q follow-up) and the footer's branch polling for repos under /mnt/<drive> now apply there too, because all WSL checks share one detection that falls back to /proc/version.
  • Fixed HTML export dropping the $ from the session cost and altering the embedded highlight.js, because $$ and $& in inserted files were expanded as replacement patterns (#12608, #12609 by @acmerfight)
  • Fixed codemode models.classify() and models.generateImages() not passing the current session ID
  • Fixed prefilled fields (the /model <term> and /login <provider> search, session rename, /tree labels, and extension input dialogs with an initial value) opening with the cursor before the text, so /model son followed by typing net searched netson (#12676, #12677 by @acmerfight)
  • Fixed undo in dialogs that clear or prefill their input, such as the /login steps and /scoped-models search, skipping the cleared or prefilled value and restoring older text, and the next kill or yank mixing with text from before the change
  • Fixed /tree branch summaries leaving out the selected user or custom message, which leaves the context and goes back to the editor, so the summary never said what the abandoned branch was asked to do. session_before_tree handlers now get that message in preparation.entriesToSummarize, and preparation.commonAncestorId is its parent (#12576, #12577 by @acmerfight)
  • Fixed selecting a user or custom message that is the current leaf in /tree doing nothing; it now moves to the message's parent and puts its text in the editor, like any other user message
  • Fixed bash commands running only partly, with exit code 0, under Git Bash on Windows when longer than about 8 KB or made of newline-separated words without spaces (#12340)
  • Fixed pi exiting immediately when its terminal goes away without SIGHUP, such as a Windows console host that exits, without saving the aborted turn or emitting session_shutdown. pi now runs the same session cleanup as for SIGHUP, without writing to the terminal, and exits with 129 after at most 5 seconds. The next start shows why pi exited, for example pi exited on ... because its terminal went away (write EPIPE). An uncaught EPIPE or EIO that does not come from the terminal, such as a write to an exited child process, is now reported as a crash instead of exiting silently (#12317)
  • Fixed codemode scripts that declare const or let named tools or console failing with SyntaxError: invalid redefinition of parameter name before they ran (#11878 by @arajkumar)
  • Fixed unloaded llama.cpp models without a configured context size getting a 128000-token context window: Pi now uses the trained context length the router reports for them (context_length in GET /models)
  • Fixed two prompt() calls that reach an idle session in the same tick both starting a run, so the second failed with Agent is already processing a prompt; the second prompt now queues into the first run by its streamingBehavior (#12186)
  • Fixed shifted characters (uppercase letters, ", :) not being typed in dialogs and search boxes such as /login, /resume, /model and /settings in terminals using xterm modifyOtherKeys (xterm, tmux, VS Code, GNOME Terminal, Apple Terminal), and /tree search ignoring keys in those terminals and with the Kitty keyboard protocol (#12727, #12728 by @acmerfight)
  • Fixed Shift+Backspace and Shift+Delete doing nothing in dialogs, search boxes and /tree search with the Kitty keyboard protocol or xterm modifyOtherKeys; they now delete as in the editor, through the tui.editor.deleteCharBackward and tui.editor.deleteCharForward defaults (#12727)
  • Fixed the overlay-test and overlay-qa-tests example extensions dropping keys sent as Kitty CSI-u or xterm modifyOtherKeys sequences
  • Fixed pi auth print-api-key and print-bearer-token with --model and no --provider failing with Model "..." not found when the key came from an environment variable or a models.json apiKey (#12667)
  • Fixed every loaded skill keeping its whole SKILL.md in memory, once per live session (#12649)
  • Fixed OpenAI Codex WebSocket sessions resending the full history every turn once the output token limit shrank as the context grew (#12444)
  • Fixed thinking signatures from Claude via OpenRouter or Bifrost (openai-completions) being dropped or merged across reasoning_details entries (#9534, #12615)
  • Fixed Google MALFORMED_RESPONSE stops (Provider stopped with: MALFORMED_RESPONSE) not being retried automatically (#12622)
  • Fixed OpenCode Go's request body limit (decoded body exceeds 50331648 bytes) being retried instead of triggering compaction (#12625)
  • Fixed Amazon Bedrock Too many tokens throttling errors not being retried automatically (#12574 by @acmerfight)
  • Fixed upstream_error: upstream SSE stream failed gateway errors not being retried automatically (#12605)
  • Fixed a second /login for OpenAI Codex, Anthropic or Radius in the same process failing with State mismatch. and waiting until it timed out (#12724)
  • Fixed DeepSeek prompt updates being sent in the wrong form: deepseek-flash now gets them in place and keeps its cached prefix, and deepseek-v4-pro gets one merged leading prompt (#12658)
  • Fixed Groq rejecting tool calls with HTTP 400 missing properties when a model left out an optional argument (#12653)
  • Fixed Gemini 3+ answering follow-ups to tool calls with 400 INVALID_ARGUMENT on Gemini-compatible hosts that return URL-safe base64 thought signatures (#12637)
  • Fixed the TUI rendering without colors under GNU screen when an inherited COLORTERM advertised truecolor; pi now uses 256 colors there unless PI_TRUE_COLOR=1 or terminal.trueColor opts in (#10618)
  • Fixed quoted lists losing the quote color after the bullet, and HTML and LaTeX blocks inside quotes not using the quote color (#12663)
  • Fixed @ file autocomplete passing queries that start with - to fd as options, so @-test showed nothing and @-u listed ignored files (#12719, #12720 by @acmerfight)

Don't miss a new pi release

NewReleases is sending notifications on new releases.