New Features
- Canonical session context and extension boundaries — Edit model context without rewriting history and add actionable lifecycle hooks. See ContextEditEntry and extension events.
- Full-transcript context extensions — Use
context_with_systemfor per-request system-message transformations. Seecontext_with_system. - Per-model image input limits — Configure cache-safe image resizing per model for attachments,
read, and tool-result images. See Image Input Limits.
Breaking Changes
- Removed the inherited
shouldStopAfterTurnagent option. UsefinishTurnand return{ action: "end" }instead.finishTurnruns beforeturn_endbut applies the decision afterward, and it also receives error and aborted responses; migrate normal-response predicates by returningundefinedfor those hard exits. See the@earendil-works/pi-agent-corechangelog for a complete before-and-after example. - Added
ContextEditEntryto the exportedSessionEntryunion. TypeScript consumers with exhaustive entry switches must handlecontext_edit; usereplacement: nullfor omission and a content replacement otherwise. - Made
SessionManagercanonical forAgentSessionprovider context. Assigningsession.agent.state.messagesno longer replaces future request history; restore withSessionManager.inMemory(cwd, { id }, entries), navigate withsession.navigateTree(), or append throughsession.sessionManagerand callsession.refreshContext(). - Expanded
TurnEndEventwith required boundary fields and addedAgentBeforeSettleEventto the exportedExtensionEventunion. Consumers constructing events or exhaustively switching onExtensionEventmust handle the new shapes.ExtensionRunner.emit()no longer acceptsturn_end; host integrations dispatch actionable boundaries withemitBoundary(baseEvent, buildContext). - Deferred runs requested from
agent_settledhandlers until all settled handlers finish. Handlers still observectx.isIdle() === true, but no longer see a reentrantagent_startduring the same notification dispatch.
Added
- Added append-only model-context edits. For example,
sessionManager.appendContextEdit(entryId, null)omits one message from future provider context without changing raw history, usage, or UI history. - Added actionable
turn_endandagent_before_settleextension boundaries. Return{ entries: [...event.entries, draft], continue: true }to persist structural entries in order and ensure one next provider request without changing steering or follow-up scheduling. - Added retain-none compaction input:
sessionManager.appendCompaction(summary, null, tokensBefore)stores the compaction's own ID as its kept boundary. - Added the
context_with_systemextension event, which runs aftercontexthandlers on the full transcript including system messages and sends its result verbatim. Seecontext_with_system. - Added per-model image resize profiles through
inputLimits.images.resizeinmodels.json, applied to file attachments, image reads, and tool-result images (#9631).
Fixed
- Fixed string context-edit replacements producing invalid assistant and tool-result message content instead of text blocks.
- Fixed context-invisible boundary metadata and replacement edits causing newly appended or replaced input to be summarized before its first provider request.
- Fixed edited-context accounting both discarding valid assistant usage captured after the latest context edit and reusing that usage after a later compaction made it stale.
- Fixed selected error retries and final length/overflow recovery retaining abandoned model attempts in future provider context; post-run recovery omissions are now persisted without hiding raw transcript history or changing queue scheduling.
- Fixed
contexthandlers that filter or slice messages dropping the prompt and tool declarations, which after extension-driven compaction left requests without built-in tools or made Codex emit raw tool-call text. Handlers no longer see system messages; Pi restores the prompt and tool state after they run. Seecontext(#9789, #9822). - Fixed
/bugallowing uploads in offline mode while preserving local zip exports (#9841 by @christianklotz). - Fixed idle prompt-cache warming rebuilding expired caches when its timer or an extension decision is delayed.
- Improved crash diagnostics with hints identifying loaded extensions that appear in the stack trace.
- Fixed text files beginning with
GIFbeing misclassified as images and omitted fromreadand CLI@fileinput (#9755). - Fixed malformed prompt template frontmatter being silently ignored instead of reported as a resource warning (#9830 by @christianklotz).
- Fixed inherited unknown OpenAI-compatible Chat Completions endpoints receiving strict tool schemas unless they explicitly advertise support (#9816).