Support client system prompt replacement and append - #124
Open
salman1993 wants to merge 1 commit into
Open
Conversation
salman1993
marked this pull request as ready for review
September 9, 2026 01:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
ACP clients cannot currently replace or append to Pi's system prompt when they create a session. Clients must use process wrappers or put standing instructions into user messages, which does not provide the same behavior.
What
Accept
_meta.systemPromptonsession/new: a nonempty string replaces Pi's base prompt, and{ "append": "..." }appends instructions. Advertise both modes and persistence throughagentCapabilities._meta.piAcp.systemPrompt.How
Validate the request before starting Pi. Pass literal prompt text through private files to Pi's existing CLI flags, then save the mode and text with the session record. Reapply that snapshot on automatic restoration and
session/load, including after an adapter restart. Remove temporary files when the subprocess exits and saved prompts when sessions are deleted.Omitting the extension preserves existing behavior. This change does not add skill or argument forwarding.
references
Risk
The saved prompt lives in the adapter's session map, separately from Pi's transcript; restoration depends on retaining that map. Pi still adds its normal context, and explicit append supersedes automatic
APPEND_SYSTEM.mddiscovery. Live checks ran on macOS; Windows process execution was not tested.Testing
PI_ACP_TEST_REAL_PI=1 node --import tsx --test test/component/pi-rpc-system-prompt.test.tspassed against Pi 0.84.4. Its RPC HTML export contained the custom prompt exactly once, and only append retained Pi's native coding preamble. No model calls were made.session/prompt. Automatic restoration of A, explicit loading of B, and restoration after a full adapter restart all preserved the correct prompt without cross-session leakage. No model calls were made.Generated with Codex