A research agent may need the conclusion from a long document without sending the entire document back on every turn. Pi’s September 21 release exposes a local SDK mechanism for that separation: SessionManager.appendContextEdit().
The public format defines an appended entry pointing at an earlier message. Passing null omits that message from future model context; a content replacement changes what the model will receive. The original message remains in raw history, UI history, exports and accounting. Edits follow the active branch, and the latest applicable edit wins.
Example: a smaller reading notebook
Use a disposable research session to keep a long, non-sensitive source excerpt as a user message. Once a short, source-linked note has been added, omit the excerpt from the projected context. The notebook can still show what the reader supplied while later requests carry the note. This illustrative snippet assumes excerptEntryId identifies that message on the active branch of an idle session:
session.sessionManager.appendContextEdit(excerptEntryId, null);
session.refreshContext();
The implementation rejects missing targets and entries outside the active branch. The SDK documentation also changes the integration rule: the session manager owns provider context. Assigning a new array to session.agent.state.messages no longer replaces persisted request history.
Copyable agent instruction
Using Pi v0.87.0 in a disposable local test, create an
in-memory SessionManager with a long synthetic user excerpt
and a short source-linked note. Record the excerpt entry ID.
Append a null context edit targeting that ID. Assert that
buildSessionProjection().messages omits the excerpt while
getEntry(id) still contains the original. Branch to a point
before the edit and check that the excerpt reappears.
Do not call a model or use real private documents. Report
which assertions you ran and which remain untested.
Access and test caveat
This is a local TypeScript SDK API, not a hosted HTTP endpoint. The proposed in-memory check needs no provider credentials; actually running an agent needs a configured model and may incur usage charges. We inspected the tagged implementation and upstream projection tests, but did not execute this example or measure token savings or answer quality.
Do not use omission as a privacy eraser: it leaves the source record intact and cannot recall earlier provider requests. The useful next check is whether the smaller context still supports the agent’s answer with the right source, while the unabridged history remains available for inspection.